﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace BusinnessLogic
{
    public class LoginCheck
    {

        public bool VerifyLogin(string username, string passw, ref int userid, ref string name, ref string firstname, ref string role)
        {

            DataLayer.dllogin dllogger = new DataLayer.dllogin();
            DataSet dts = dllogger.LoginCheck(username, passw);

            if (dts.Tables[0].Rows.Count != 0)
            {
                userid = int.Parse(dts.Tables[0].Rows[0]["UserID"].ToString());
                name = dts.Tables[0].Rows[0]["Name"].ToString();
                firstname = dts.Tables[0].Rows[0]["FirstName"].ToString();
                role = dts.Tables[0].Rows[0]["Role"].ToString();
                return true;
            }
            else
            {
                return false;
            }

            
        }

    }
}
